🚀 [Feature]: Norwegian legal data, no account needed - #16
Conversation
Drop the Context vault, the stored contexts, the authenticated legal-source command, and the API key injection so the module targets Lovdata's open, key-free surface. Settings now live in memory for the session only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add Get-LovdataPublicDataset and Save-LovdataPublicDataset for Lovdata's free open data packages, and Test-LovdataConnection and Get-LovdataApiVersion for the open service endpoints. Introduce the LovdataPublicDataset and LovdataApiVersion classes and a streaming download helper. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Cover Config, PublicData, and Service commands plus the internal transport and download helpers with mocks at the module boundary, so the suite runs offline with no network and no key. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Lead the README with the key-free story and Install-PSResource, replace the context-based examples with open-data and service scenarios, and update SECURITY.md to state that the module stores no secret. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…int clean PlatyPS renders example command lines without a code fence, so a literal URL in an example trips markdownlint MD034. Use a variable instead. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The API reports lastModified as an ISO-8601 Z string, but a bare [datetime] cast converts it to the runner's local time, so the same package can report a different calendar day depending on the machine's timezone. Parse with InvariantCulture and RoundtripKind so the value stays UTC and machine-independent. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
FileName flowed unchecked into Join-Path and the download endpoint, so a value like '../../evil.txt' wrote outside -Path, bypassed the overwrite check against the un-normalised path, and escaped the URL segment. Validate it as a bare filename at the parameter, which closes the path and the URL in one place. Also resolve -Path with -LiteralPath and use its ProviderPath so a directory name containing wildcard characters resolves correctly, and drop the module's own static progress bar since Invoke-WebRequest -OutFile already renders one. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Reviewed and verified independently before merge. The The UTC parse returns CI green on |
d6edce1
into
build-lovdata-module
Norwegian legal data is now available from PowerShell with no account, no API key, and nothing to configure. This first release wraps Lovdata's open, key-free surface: the current acts and central regulations published as free open data under NLOD 2.0, plus the service endpoints that report whether the API is up and which build is deployed. Install the module and pull the full corpus of Norwegian acts in two commands.
New: List and download Lovdata's free open data packages
Get-LovdataPublicDatasetlists the packages Lovdata publishes, each with the filename, size, and last-modified date so you can decide what to fetch.Save-LovdataPublicDatasetdownloads one to a directory, streaming large packages straight to disk with progress and refusing to overwrite an existing file unless you pass-Force. It takes a dataset from the pipeline, so listing and downloading compose directly:The NLOD 2.0 licence and the requirement to credit Lovdata are stated in the command help, not only the README.
New: Check service reachability and the deployed API version
Test-LovdataConnectionreturns a boolean and never throws on an unreachable service, so it is safe to use directly in a conditional as a first-run diagnostic.Get-LovdataApiVersionreturns the deployment name, build timestamp, and revision. Both work with no account.New: Session settings with nothing stored on disk
Get-LovdataConfigandSet-LovdataConfigexpose the API base URI for the current session. The settings live in memory only; the module stores no secret and writes nothing to disk.Removed: The API key surface, deferred to a later release
The commands that required a stored API key (
Connect-LovdataAccount,Disconnect-LovdataAccount,Get-LovdataContext,Switch-LovdataContext,Get-LovdataLegalSource) are not part of this release. The authenticated surface and the credential store it needs return in #15. Because these commands never shipped in a published release, no upgrade step is needed.Technical Details
Contextdependency entirely: dropped the vault, theLovdataContextandLovdataLegalSourceclasses,Resolve-LovdataContext,Initialize-LovdataConfig, and all#Requires -Modules Contextlines. The implementation is recoverable frombuild-lovdata-modulehistory for Add the authenticated Lovdata API surface in a later release #15.LovdataConfigkeeps onlyApiBaseUri; settings are seeded from a module default and held in the$script:Lovdatavariable for the session.Invoke-LovdataAPIno longer takes a-Contextor injectsX-API-Key; it reads the base URI from config, keeps the query-string builder, JSON-with-plain-text fallback, RFC 9457 error translation, and rate-limit verbose output, and drops the 401 branch while keeping 429 and the generic branch.Invoke-LovdataDownload, besideInvoke-LovdataAPIso the JSON transport stays untouched; it usesInvoke-WebRequest -OutFilewithWrite-Progress.LovdataPublicDataset(SizeBytesas[long],LastModifiedas[datetime]) andLovdataApiVersion.Config,PublicData,Service,Lovdata.Internals) mocks the module-owned boundary and passes offline with no network and no key.Invoke-ScriptAnalyzeris clean againstsrc.Save-LovdataPublicDataset -Pathmust point at an existing directory and throws a clear error otherwise (it does not create directories); the private download helper is namedInvoke-LovdataDownload;ToString()on the new classes returns the filename and the name-plus-timestamp respectively; the examples emit status to the output stream rather thanWrite-Hostto stay analyzer-clean.Get-LovdataUser(/v1/userinfo) and everything else needing a key remain in Add the authenticated Lovdata API surface in a later release #15.Related issues